﻿/*
 ***************************************************************************
 * Microsoft Visual C# .NET
 * 名称：       App_System_HealthMenuPart
 * 类型：       控制层

 * 功能说明：   健康按钮区显示
 *              
 * 作者：       谈震鸣
 * 创建日期：   2007/12/13
 * 修改日期     修改者      修改内容
 * 
 * 
 * ---
 ***************************************************************************
*/
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Shpm.App.Input.Bean;
using Shpm.App.Input.Dao;
using Shpm.App.Commons.Utils;
using Shpm.System;
using Shpm.App.Commons.Db.Beans.Master;
public partial class App_System_HealthMenuPart : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        boundLeft();
        boundRight();
    }

    //绑定报名对象
    private void boundLeft()
    {
        HappyPlanDao dao = new HappyPlanDao();
        HappyPlanBean beanHP = new HappyPlanBean();
        IList dataList = dao.ListHappyPlanLeft(beanHP);

        if (dataList.Count > 0)
        {
            IEnumerator enm = dataList.GetEnumerator();
            while (enm.MoveNext())
            {
                beanHP = (HappyPlanBean)enm.Current;
                TableRow tblRow = new TableRow();
                TableCell tblCell;
                LinkButton lbtnName = new LinkButton();
                tblCell = new TableCell();
                lbtnName.Text = beanHP.ActionName;
                lbtnName.CommandArgument = Convert.ToString(beanHP.ActionId);
                lbtnName.Command += new CommandEventHandler(this.LinkButton_Command_Left);
                tblCell.Controls.Add(lbtnName);
                tblRow.Cells.Add(tblCell);
                TblItem.Rows.Add(tblRow);
            }
        }
    }
    //绑定评估对象
    private void boundRight()
    {
        HappyPlanDao dao = new HappyPlanDao();
        HappyPlanBean beanHP = new HappyPlanBean();
        IList dataList = dao.ListHappyPlanRight(beanHP);

        if (dataList.Count > 0)
        {
            IEnumerator enm = dataList.GetEnumerator();
            while (enm.MoveNext())
            {
                beanHP = (HappyPlanBean)enm.Current;
                TableRow tblRow = new TableRow();
                TableCell tblCell;
                LinkButton lbtnName = new LinkButton();
                tblCell = new TableCell();
                lbtnName.Text = beanHP.ActionName;
                lbtnName.CommandArgument = Convert.ToString(beanHP.ActionId);
                lbtnName.Command += new CommandEventHandler(this.LinkButton_Command_Right);
                tblCell.Controls.Add(lbtnName);
                tblRow.Cells.Add(tblCell);
                TblItem2.Rows.Add(tblRow);
            }
        }
    }
    //点击报名对象
    protected void LinkButton_Command_Left(object sender, CommandEventArgs e)
    {

        string directUrl;
        Context.Items["ACTION_ID"] = e.CommandArgument;
        directUrl = "~/App/Input/HappyIntentUpdForm.aspx";
        Context.Items["InpActName"] = "";
        Context.Items["InpActType"] = "";
        Context.Items["InpActStat1"] = "";
        Context.Items["InpActStat2"] = "";
        Context.Items["InpBeginDate"] = "";
        Context.Items["InpEndDate"] = "";
        ControllerUtils.Transfer(this.Context, directUrl, true);
    }
    //点击评估对象
    protected void LinkButton_Command_Right(object sender, CommandEventArgs e)
    {

        string directUrl;
        Context.Items["ACTION_ID"] = e.CommandArgument;
        directUrl = "~/App/Input/HappyEvaluateUpdForm.aspx";
        Context.Items["InpActName"] = "";
        Context.Items["InpActType"] = "";
        Context.Items["InpActStat1"] = "";
        Context.Items["InpActStat2"] = "";
        Context.Items["InpBeginDate"] = "";
        Context.Items["InpEndDate"] = "";
        ControllerUtils.Transfer(this.Context, directUrl, true);
    }
}
